package cn.sfa.common.utils;


import java.util.ArrayList; 
import java.util.HashSet; 
import java.util.Iterator; 
import java.util.List; 

/**
 * 去掉list里面重复的数据
 * 
 * @author hui
 * 
 */
public class DeleteRepeatIds {

	/**
	 * 
	 * 
	 * @param ids
	 * @return
	 */
	public static List<String> removeDuplicateWithOrder(List<String> list) {
		HashSet<String> hashSet = new HashSet<String>();
		List<String> newlist = new ArrayList<String>();
		for (Iterator iterator = list.iterator(); iterator.hasNext();) {
			String element = (String) iterator.next();
			if (hashSet.add(element)) {
				newlist.add(element);
			}
		}
		list.clear();
		list.addAll(newlist);
		return list;
	}
}
